﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;

namespace Shared.SqlAuditHelper
{
    public static class SqlAuditExtensions
    {
        /// <summary>
        /// 加入SQL 审计
        /// </summary>
        /// <param name="sqlSugarClient"></param>
        /// <returns></returns>
        public static SqlSugarClient SqlAudit(this SqlSugarClient sqlSugarClient)
        {
            sqlSugarClient.Aop.OnLogExecuted = Shared.SqlAuditHelper.SqlAudit.LogExecuted;
            sqlSugarClient.Aop.OnLogExecuting = Shared.SqlAuditHelper.SqlAudit.LogExecuting;
            sqlSugarClient.Aop.OnError = Shared.SqlAuditHelper.SqlAudit.Error;
            sqlSugarClient.Aop.OnExecutingChangeSql = Shared.SqlAuditHelper.SqlAudit.ExecutingChangeSql;

            return sqlSugarClient;
        }
    }
}
